package br.com.pentagrama.service.ui.component;

import java.awt.Container;
import java.awt.Dimension;

import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class RangeRow {
	private JPanel panel;
	private int index;
	private Field field;

	public RangeRow(int index, int maximumWidth, int maximumHeight, Field field) {
		this.index = index;
		panel = new JPanel();
		panel.setMaximumSize(new Dimension(maximumWidth, maximumHeight));
		panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
		this.field = field;
	}

	public void showIn(Container container) {
		JCheckBox checkBox = new JCheckBox();
		panel.add(checkBox);
		
		panel.add(Box.createHorizontalStrut(50));
		
		String number = String.format("%d)", (index + 1));		
		JLabel label = new JLabel(number);		
		panel.add(label);
		
		panel.add(Box.createHorizontalStrut(50));
		
		field.showIn(panel);
		
		container.add(panel);
	}
}
